<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        div {
            width: 1423px;
            margin: 0 auto;
            text-align: center;
        }
        .middle {
            width: 100%;
        }
        
    </style>
</head>
<body>
    <div class="top">
        <img src="images/top.png" alt="">
    </div>
    <div class="middle">
        <img src="images/nav.png" alt="">
    </div>
    <div class="bottom">
        <img src="images/main.png" alt="">
    </div>
    <script src='../jquery-1.12.4.js'></script>
    <script>
        $(function(){
            $(window).on('scroll',function(){
                console.log('1');
                
                if($(this).scrollTop() >= $('.top').height()){
                    $('.middle').css('position','fixed').css('top',0)
                    $('.bottom').css('marginTop',$('.middle').height())
                }else {
                    $('.middle').css('position','static');
                    $('.bottom').css('marginTop',0)

                }
            })
        })
    </script>
</body>
</html>